功能意义:命令下发会指定某台Modbus设备,并对此设备的指定属性进行异步读写。
功能描述:添加一条Modbus设备异步命令,通过Dtu设备进行数据的上传和下发。
注:需要设备绑定到Dtu设备,并且Dtu设备在线。
POST /api/v1/commands-async/modbus-dtu
Body
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
functionType | string | 命令类型,(propertyGet/propertySet) | Yes |
identifier | string | 属性名 | Yes |
identifierValue | object | 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes | No |
Body example:
{
"deviceId":10000195,
"functionType":"propertySet",
"identifier":"prop_api_modbus_01u",
"identifierValue":32
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async/modbus-dtu?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceId":10000195,
"functionType":"propertySet",
"identifier":"prop_api_modbus_01u",
"identifierValue":32
}'
Response data:
Name | Type | Description |
---|---|---|
commandId | string | 命令ID |
Response example:
{
"code": 0,
"msg": null,
"data": {
"commandId": "5caaf54ae1382315d9c69c63"
}
}
功能描述:Modbus-Dtu异步下发命令读取/写入功能点属性信息
POST /api/v1/device/command/byname/dtu/async
Body:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
deviceName | string | 设备名称 | Yes |
functionType | string | 命令类型,可选值propertyGet/propertySet | Yes |
identifier | string | 属性名 | Yes |
identifierValue | object | 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes | No |
Body example:
{
"productId":10086,
"deviceName": "test",
"functionType": "propertySet",
"identifier": "身高",
"identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/command/byname/dtu/async?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"productId":10086,
"deviceName": "test",
"functionType": "propertySet",
"identifier": "身高",
"identifierValue": "180"
}'
Response data:
Name | Type | Description |
---|---|---|
commandId | string | 命令ID |
Response example:
{
"code":0,
"message":null,
"data":{
"commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
}
}